<heapQueue>

A heapqueue is an Object array and double array the same size, where index 0 is not used, and the childs of index X are indexs 2*X and 2*X+1, and the highest double is at index 1, and when index 1 changes, it swaps with its highest child and recurses.

<question>
	Should a heapQueue start at index 0 or index 1?
	<index1>
		Calculating parent/child indexs is faster, and maybe index 0 could be used for something extra like adding to the heapQueue.
		<parentChildAlgorithm>
			childs of index X = 2*X and 2*X+1
			parent of index X = X >> 1, or no parent if X == 1
		</parentChildAlgorithm>
	</index1>
	<index0>
		Its easier to calculate the size of the heapQueue.
		<parentChildAlgorithm>
			childs of index X = 2*X+1 and 2*X+2
			parent of index X = ((X+1) >> 1)-1, or no parent if X == 0
		</parentChildAlgorithm>
	</index0>
	Starting at index 1 is faster, and the extra 1 index is a small price to pay for that.
</question>

<question>
	Except for index 0, does a heapQueue always have to be full, and if not, should the unused indexs always be at the end?
	<mustBeFull>
		The heapQueue must be completely copied to a new array every time something is added or removed.
		Thats similar to all nonHeapQueue Object arrays in a node or network, which must always be full.
		<question>Should index 0 have Double.POSITIVE_INFINITY?</question>
	</mustBeFull>
	<notFullNotContiguous>
		Its slow to calculate size of the heapQueue because the indexs that are used are probably not contiguous.
		<question>Should index 0 have Double.POSITIVE_INFINITY?</question>
	</notFullNotContiguous>
	<notFullYesContiguous>
		This is the fastest of the 3 options.
		Its fast to calculate size of the heapQueue because size is stored somewhere or a binary search can find it.
		Its fast to add and remove from it because it usually does not have to be copied to a new Object array.
		Index 0 has Double.POSITIVE_INFINITY, and all unused indexs have Double.NEGATIVE_INFINITY.
		<algorithmForAdd>
			If the 2 arrays are full, copy to array 2 times the size.
			Put new thing at first unused index.
			Run the normal floIncreased algorithm on that index.
		</algorithmForAdd>
		<algorithmForRemove>
			Decrease flo of the index to remove to Double.NEGATIVE_INFINITY.
		</algorithmForRemove>
	</notFullYesContiguous>
</question>

<question>
	Should all Object and double arrays in nodes and networks ignore index 0?
	That would simplify using heapQueues and nonHeapQueues together and allow converting one to the other.
	It would complicate things like the weights in a bayesian node because each bayesian child has a bit index,
	and that is not explicity coded, only useful in optimizations.
</question>



</heapQueue>